// JavaScript Document// JavaScript Document// JavaScript Document
				var error = "";
				var cusName="";
				var cusadd="";
				var cusemail="";
				var cusphone="";
				
function validateForm2(strURL,formname,responsediv,responsemsg) {
				error = "";

				
				var _boolForm = 0;
				var emptyPreMessge = "You must include an accurate";
				var emptyPostMessge = "for a response";
				//var "Invalid E-mail ID" = "Invalid E-mail ID"

				
				cusName=document.forms["frmCustomer"]["txtCustomerName"].value;
				cusadd=document.forms["frmCustomer"]["textAdd"].value;
				cusemail=document.forms["frmCustomer"]["txtEmail"].value;
				cusphone=document.forms["frmCustomer"]["txtPhone"].value;
				document.getElementById("status").innerHTML	= "";
				
								//alert(cusadd);

				var nameError = "";
				if(cusName == "" || cusName == null)
				{
					document.forms["frmCustomer"]["txtCustomerName"].focus();
					error = "Customer Name must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(cusName,3,25) == true)
				{
					
					if(isAlphabet(cusName) == true)
					{
						_boolForm = 0;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmCustomer"]["txtCustomerName"].focus();
						error = "Customer Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
					document.forms["frmCustomer"]["txtCustomerName"].focus();
					error = "Please enter the Customer Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
				
				
			
				
				
									
								if(cusemail == "" || cusemail == null) // Email is not entered feels it is empty
								{
									//show_image();
									document.forms["frmCustomer"]["txtEmail"].focus();
									error = "Email must not be empty";
									document.getElementById("status").innerHTML	= error;
									
									
									return false;
								}
								else if(emailcheck(cusemail) == true )// Email is  entered feels it is valide elase not valid
								{
									_boolForm = 0;  // if valid bool setting to zero check other fields
								}
								else // Email is not valid
								{
									document.forms["frmCustomer"]["txtEmail"].focus();
									error = emptyPreMessge+" Email Address "+emptyPostMessge;
									document.getElementById("status").innerHTML	= error;
									return false; // email not valid so returning false
								}
								
								if(document.getElementById("textAdd").value==null || document.getElementById("textAdd").value=="")
				{
					//alert("blank text area")
					document.getElementById("textAdd").focus();
						error = "Please enter Address";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
					}

								
								if(cusphone == "" || cusphone == null)
								{
									document.forms["frmCustomer"]["txtPhone"].focus();
									error = "Phone Number must not be empty";
									document.getElementById("status").innerHTML	= error;
									return false
								}
								else if(phonelength(cusphone,8) == true)
								{
										
									_boolForm = 1;
								}
								else 
								{
									//alert("Error message cusemail else cusphone");
									error = "Please enter the Phone Number with your country code";
									return false;
								}
				
				
				if(_boolForm == 1)
				{
			document.getElementById("frmCustomer").submit();
			
			}
					
	
			else
			return false;
				
}

function getTinyFormQuerystring() {

   var qstr = "name="+cusName+"&tech="+prodTech+"&file="+prodPic+"&cat="+prodCat+"&price="+prodPrice;
	alert(qstr);
    return qstr;

}

function updatepage(str,responsediv){

    document.getElementById(responsediv).innerHTML = str;

}


function updatepage(str,responsediv){
    document.getElementById(responsediv).innerHTML = str;
}


	
function lengthRestriction(str, min, max){
	//var uInput = elem.value;
	//alert("lent")
	if(str.length >= min && str.length <= max){
		return true;
	}else{
		//alert("Please enter between " +min+ " and " +max+ " characters");
		document.forms["frmCustomer"]["txtCustomerName"].focus();
		error = "Please enter the Name between " +min+ " and " +max+ " characters";
		document.getElementById("status").innerHTML	= error;
		return false;
	}
}
function emailcheck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   // alert("Invalid E-mail ID")
		    return false
		 }

 		 return true;					
	}

function isAlphabet(str){
	var alphaExp = /^[a-zA-Z-_ .',]+$/;
	if(str.match(alphaExp)){
		return true;
	}else{
		//alert("name must contain only letters");
		document.forms["frmCustomer"]["txtCustomerName"].focus();
		error = "Name must contain only letters";
		document.getElementById("status").innerHTML	= error;
		//elem.focus();
		return false;
	}
}

function phonelength(str,min){
	//var uInput = elem.value;
	if(str.length >= min){
		//alert(str.length);
		return true;
	}
	else{
		//alert("Please enter the phone number with your country code");
		document.forms["frmCustomer"]["txtPhone"].focus();
		error = "Please enter the Phone Number with your country code";
		document.getElementById("status").innerHTML	= error;
		return false;
	}
}

function numbersonly(e) {
var unicode=e.charCode? e.charCode : e.keyCode;
//alert(unicode)
	if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
			if(unicode == 40 || unicode == 41) // () allowing
			{
				return true;
			}
			else if(unicode == 45 || unicode == 43) //45- && 43 + 
			{
				return true;
			}
			else if(unicode == 58 || unicode == 32) //58 :- && 32 space
			{
				return true;
			}
			else if(unicode == 37 || unicode == 39) //Delete
			{
				return true;
			}
			else if(unicode == 46 || unicode == 13) //Delete and enter
			{
				return true;
			}
			else if(unicode == 9) //tab
			{
				return true;
			}
			else if (unicode<48||unicode>57)
			{
			  document.getElementById("status").innerHTML	= "Please enter the numbers";
			  return false;//if not a number return false //disable key press
			}
		}
} 




function validate(x)
{
var xx=document.getElementById('pic').value
if((xx=='')||( xx==null))
{
        var filename=document.getElementById('filePicture').value;
        var extension=filename.substr(filename.lastIndexOf('.')+1).toLowerCase();
        if (filename) {
            if (extension=='png' || extension=='gif' || extension=='jpg' ||extension=='jpeg') {
            } else {
										alert('Allowed Extensions are "png","gif" and "jpg" !');

				document.forms["frmCustomer"]["filePicture"].focus();
						error = 'Allowed Extensions are "png","gif" and "jpg" !';
						document.getElementById("status").innerHTML	= error;
						return false;
                //alert('Allowed Extensions are "png","gif" and "jpg" !');
                return false;
            }
        } else {
            //alert('Select upload files!');
            return false;
        }
   
    return true;
}
else
{
	return true;
}    


}

















// append image
//var img = document.createElement("img");
function show_image() {
    var img = document.createElement("IMG");
	//img.src = "Small Alert Icon.png";
    img.src = "Small Alert Icon.png";
   // img.width = width;
   // img.height = height;
    //img.alt = alt;

    // This next line will just add it to the <body> tag
    //document.body.appendChild(img);
	document.getElementById('status').appendChild(img);
}



